// const urlBasePath = "http://119.23.105.111:9030"
// //生成随机 GUID 数
// function guid() {
// 	function S4() {
// 		return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
// 	}
// 	return (S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4());
// }
// let loginMark = guid()

// let mock = {}

// const _request = function(url, data, option) {
// 	var token = global.getApp().globalData.userInfo.token;
// 	const requestData = {
// 		loginMark: loginMark,
// 		token: token
// 	}
// 	if (data !== undefined && data != null) {
// 		if (typeof(data) === 'string')
// 			requestData.data = data
// 		else
// 			requestData.data = JSON.stringify(data)
// 	}

// 	// if (mock && mock[url]) {
// 	// 	return mock[url](data)
// 	// }
// 	return new Promise((resolve, reject) => {
// 		uni.request({
// 			url: urlBasePath + url,
// 			data: requestData,
// 			method: option && option.method || 'GET',
// 			success(result) {
// 				if (result.data.code === 200) {
// 					resolve(result.data)
// 				} else {

// 					reject(result.data)
// 					uni.showToast({
// 						icon: 'none',
// 						title: result.data.info,
// 						duration: 6000
// 					})
// 					if (result.data.code === 410) {
// 						uni.showModal({
// 							title: '登录错误',
// 							content: '当前token为' + token,
// 							success: function(res) {
// 								if (res.confirm) {} else if (res.cancel) {}
// 							}
// 						});
// 					}
// 				}
// 			},
// 			fail(err) {
// 				reject(err)
// 			}
// 		})
// 	})
// }
// const _get = function(url, data) {
// 	return _request(url, data, {
// 		method: 'GET'
// 	});
// }
// const _post = function(url, data) {
// 	return _request(url, data, {
// 		method: 'POST'
// 	});
// }

import base from './api.base.js'
const _post = base.post;

const api = {
	company_list: () => _post("/wms/company/list"),
	login: (model) => _post('/wms/login', model),
	billtype_list: (type) => _post("/wms/billtype/list", type || 1),


	billmasterpage: (arg) => _post("/wms/billmasterpage", arg),


	billdetail: ({
		billId,
		optType,
		bigType
	}) => _post("/wms/billdetail", {
		bigType: bigType || 1,
		opType: optType || 'RECEIVE',
		billId: billId
	}),
	// 理货物料扫码
	receive: (billNo, scanInfo, opType) => _post("/wms/receive", {
			opType: opType || 'RECEIVE',
			billNo: billNo,
			scanInfo: scanInfo
		})


		//
		,
	putway_billmasterpage: (billType, bill, pageIndex, pageSize) => _post("/wms/billmasterpage", {
		bigType: 1,
		opType: 'PUTAWAY',
		billType: billType,
		keyWords: bill,
		page: pageIndex || 1,
		rows: pageSize || 20,
	}, true),
	// 
	needputaway: (billNo, pageIndex, pageSize) => _post("/wms/needputaway", {
		billNo: billNo,
		page: pageIndex,
		rows: pageSize
	}),
	checkbin: (num) => _post('/wms/checkbin', num),

	putaway: (binId, todoNum) => _post("/wms/putaway", {
		opType: 'PUTAWAY',
		binId: binId,
		scanInfo: todoNum
	}),
	move: (binId, todoNum) => _post("/wms/move", {
		binId: binId,
		scanInfo: todoNum
	}),
	pickup: (arg) => _post("/wms/pickup", arg),

	wh_list: () => _post("/wms/wh/list"),

	//工单解析
	moissueinfo: (arg) => _post("/wms/moissueinfo", arg),

	mopickup: (arg) => _post("/wms/mopickup", arg),
	billmolist:(arg)=>_post("/wms/billmolist",arg),
	//调拨
	dbmasterpage: (arg) => _post("/wms/dbmasterpage", arg),
	dbdetail: (bill) => _post("/wms/dbdetail", bill || ''),
	allocation: (arg) => _post("/wms/allocation", arg),
	//盘点
	cimasterpage: (arg) => _post("/wms/cimasterpage", arg),
	cidetail: (arg) => _post("/wms/cidetail", arg),
	cioperation: (arg) => _post("/wms/cioperation", arg),
	// 初始化库存
	unit_list: (arg) => _post("/wms/unit/list", arg),
	initstore: (arg) => _post("/wms/initstore", arg),

	//销售出库 成品发货
	getshipidpage: (arg) => _post("/wms/getshipidpage", arg),
	getshipdetail: (bill) => _post("/wms/getshipdetail", bill),
	shipoperation: (arg) => _post("/wms/shipoperation", arg),
	moinstore: (arg) => _post("/wms/moinstore", arg),
	getmoinstoredetail: (bill) => _post("/wms/getmoinstoredetail", bill)
}
 
export default api
